﻿using Architecture.Domain.Service;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand;
using System.Net;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler
{
    public class UserCreateCommandHandler : IRequestHandler<UserCreateCommand, int>
    {
        private readonly IUserService userService;

        public UserCreateCommandHandler(IUserService userService)
        {
            this.userService = userService;
        }

        public async Task<int> Handle(UserCreateCommand request, CancellationToken cancellationToken)
        {
            return await userService.AddUser(new UserInfo() { UserName = request.UserName, ProvinceInfoId = request.ProvinceInfoId, CityInfoId = request.CityInfoId, countyId = request.countyId, Address = request.Address, IsDel = request.IsDel, department = request.department, IsBoos = request.IsBoos });
        }
    }
}
